<template>
	<view class="container" ref="container">
		<image :src="img" class="imgs" mode=""></image>
		<view class="btns" @click="shareImg">立即分享</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				img:''
			};
		},
		onLoad() {
			this.$utils.requert({
				url: 'staticData',
				type: 'get',
			}).then(res => {
				if (res.code === 1) {
					this.img = res.data.shareImg
				} else {
					this.$utils.showLayer(res.message)
				}
			})
		},
		methods:{
			shareImg(){
				let _this = this
				uni.saveImageToPhotosAlbum({
					filePath: this.img,
					success: function () {
						_this.$utils.showLayer('图片已保存本地相册')
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	uni-page-body{
		display: flex;
		flex-direction: column;
	}
	.container{
		flex: 1;
		height: 20%;
		display: flex;
		flex-direction: column;
		background-size: contain !important;
	}
	.imgs{
		width: 100%;
		display: block;
		flex: 1;
		height: 100vh;
	}
	.btns{
		width: 70%;
		height: 88rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 34rpx;
		font-weight: bold;
		border-radius: 50rpx;
		background:linear-gradient(360deg,rgba(255,160,0,1),rgba(255,207,0,1));
		color: white;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 100rpx;
		margin: 0 auto;
	}
</style>
